$(document).ready(function(){
  // 在这里写你的代码..

	var name="";
	var stuid="";
	var homework="";
	
//	var formData = new FormData($( "#inputForm" )[0]); 
	
	$("#subbtn1").click( function () {
		var form=document.forms.namedItem("inputForm")
		var formData= new FormData(form);
//		console.log(formData);
		console.log(formData);
		$.ajax({  
            url: "/fileUpload",
            type: 'POST',  
            data: formData,
            async: false,  
            cache: false,  
            contentType: false,  
            processData: false,  
            success: function (data) {  
              console.log("***1***"+data) ;
              if(data!=="false"){
              $("#statuid").html("提交成功");
              homework=data;}
              else{
            	  $("#statuid").html("提交失败");
              }
            },  
               error: function (data) {  
            	  alert("您提交的文件不符合规定") ;
               }  
          });
	});
	
	$("#handinbtn").click( function () {
name=$("#stuname").val();
stuid=$("#stuid").val();
//homework=$("#homework").html();
console.log("homework:"+homework);
console.log(name);
$.post("/add", { name:name,stuid:stuid,homework:homework } );
		alert("提交成功");
window.location.href="handinhomework.html";
	});
	
});